﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace bonus.Models
{
	/// <summary>
	/// 交易日志
	/// </summary>
	public class Journal
	{
		/// <summary>
		/// ID
		/// </summary>
		public ObjectId _id { get; set; }

		/// <summary>
		/// 获奖者编号
		/// </summary>
		public string GetNO { get; set; }

		/// <summary>
		/// 获得者名字
		/// </summary>
		public string Name { get; set; }

		/// <summary>
		/// 日志编号
		/// </summary>
		public string JournalNO { get; set; }

		/// <summary>
		/// 交易类型
		/// </summary>
		public int Type { get; set; }

		#region 类型

		/// <summary>
		/// 交易类型
		/// </summary>
		public class TypeClass
		{

			/// <summary>
			/// 直推奖
			/// </summary>
			public static readonly int ZHITUI = 0;

			/// <summary>
			/// 差额奖
			/// </summary>
			public static readonly int CHAE = 1;

			/// <summary>
			/// 育成奖
			/// </summary>
			public static readonly int YUCHENG = 2;

			/// <summary>
			/// 管理费
			/// </summary>
			public static readonly int GUANLI = 3;

			/// <summary>
			/// 提现
			/// </summary>
			public static readonly int WITHDRAW = 4;

			/// <summary>
			/// 特殊情况(用户退单)
			/// </summary>
			public static readonly int TESHU = 5;

			/// <summary>
			/// 公司补贴
			/// </summary>
			public static readonly int BUTIE = 6;

			/// <summary>
			/// 公司进账
			/// </summary>
			public static readonly int JINZHANG = 7;

			public static string GetType(int Status)
			{
				string StatusDesc = string.Empty;
				switch (Status)
				{
					case 0:
						StatusDesc = "直推奖";
						break;
					case 1:
						StatusDesc = "差额奖";
						break;
					case 2:
						StatusDesc = "育成奖";
						break;
					case 3:
						StatusDesc = "管理费";
						break;
					case 4:
						StatusDesc = "提现";
						break;
					case 5:
						StatusDesc = "退单";
						break;
					case 6:
						StatusDesc = "补贴";
						break;
					case 7:
						StatusDesc = "进账";
						break;
					default:
						StatusDesc = "异常";
						break;
				}
				return StatusDesc;
			}

		}

		#endregion

		/// <summary>
		/// 进账金额
		/// </summary>
		public decimal In { get; set; }

		/// <summary>
		/// 出账金额
		/// </summary>
		public decimal Out { get; set; }

		/// <summary>
		/// 余额
		/// </summary>
		public decimal Rest { get; set; }

		/// <summary>
		/// 订单金额
		/// </summary>
		public decimal OrderMoney { get; set; }

		/// <summary>
		/// 订单编号
		/// </summary>
		public string OrderNo { get; set; }

		/// <summary>
		/// 操作员
		/// </summary>
		public string Operator { get; set; }

		/// <summary>
		/// 标题   如:育成奖;订单:17122779390848
		/// </summary>
		public string Title { get; set; }

		/// <summary>
		/// 备注   如:奖金:35.0; 管理费:2.8;爱心基金:3.5 
		/// </summary>
		public string Remarks { get; set; }

		/// <summary>
		/// 状态 提现的时候回用到(0未待处理,1为已处理)
		/// </summary>
		public int State { get; set; }

		/// <summary>
		/// 添加时间
		/// </summary>
		[BsonDateTimeOptions(Kind = DateTimeKind.Local)]
		public DateTime AddDT { get; set; }

	}
}